package com.baidu.health.service.impl;

import com.baidu.health.pojo.ResultResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baidu.health.pojo.TbExceloss;
import com.baidu.health.service.TbExcelossService;
import com.baidu.health.mapper.TbExcelossMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 *
 */
@Service
public class TbExcelossServiceImpl extends ServiceImpl<TbExcelossMapper, TbExceloss>
    implements TbExcelossService{
    @Autowired
    private TbExcelossMapper tbExcelossMapper;
    @Override
    public ResultResponse excelossSelect(TbExceloss exceloss) {
        String excelossName = exceloss.getExcelossName();
        QueryWrapper queryWrapper=new QueryWrapper();
        if(!StringUtils.isEmpty(exceloss.getExcelossName())){
            queryWrapper.like("exceloss_name",excelossName);
        }
        List<TbExceloss> list = tbExcelossMapper.selectList(queryWrapper);
        return ResultResponse.SUCCESS(list);
    }

    @Override
    public ResultResponse excelossUpdate(TbExceloss exceloss) {
        tbExcelossMapper.updateById(exceloss);
        return ResultResponse.SUCCESS();
    }

    @Override
    public ResultResponse excelossDelete(Integer excelossId) {
        tbExcelossMapper.deleteById(excelossId);
        return ResultResponse.SUCCESS();
    }
}




